home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 11587 / 11587.xpi / chrome / aviary.jar / content / actionPrompt.xul next >
Extensible Markup Language  |  2009-07-08  |  4KB  |  123 lines

  1. <?xml version="1.0"?>
  2. <!-- Copyright (c) 2009 Pearl Crescent, LLC.  All Rights Reserved.  -->
  3. <!-- vim: set sw=2 sts=2 ts=8 et syntax=xml: -->
  4.  
  5. <!DOCTYPE window [
  6. <!ENTITY % aviaryDTD SYSTEM "chrome://aviary/locale/extension.dtd">
  7. %aviaryDTD;
  8. <!ENTITY % dlogoverlayDTD SYSTEM "chrome://global/locale/dialogOverlay.dtd">
  9. %dlogoverlayDTD;
  10. ]>
  11.  
  12. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
  13. <?xml-stylesheet href="chrome://aviary/skin/browserOverlay.css"
  14.                  type="text/css"?>
  15. <?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
  16.  
  17. <window id="aviary-actionPrompt"
  18.         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
  19.         onload="doInit();">
  20.   <script type="application/x-javascript"
  21.           src="chrome://aviary/content/pearlutil.js"/>
  22.  
  23.   <script type="application/x-javascript">
  24.     <![CDATA[
  25.       // These constants are also in browserOverlay.js
  26.       const kActionNone = 0;
  27.       const kActionSaveToAviary = 1;
  28.       const kActionSaveAndOpen = 2;
  29.       const kActionSaveToDesktop = 3;
  30.       const kActionCopyToClipboard = 4;
  31.  
  32.       var gPearlUtil = com.aviary.talon.pearlutil;
  33.       var gParamObj = null;
  34.  
  35.       function doInit()
  36.       {
  37.         window.document.title = gPearlUtil.GetLocalizedString("ALERT_TITLE");
  38.  
  39.         gParamObj = window.arguments[0];
  40.         doSetOKCancel(null, doCancel, null, null);
  41.         window.sizeToContent();
  42.       }
  43.  
  44.       function onSaveToAviary()
  45.       {
  46.         if (!gParamObj || !gParamObj.authService || !gParamObj.loginURL)
  47.           return;
  48.  
  49.         if (gParamObj.authService.isLoggedIn)
  50.         {
  51.           returnResult(kActionSaveToAviary);
  52.           return;
  53.         }
  54.  
  55.         const knsIPS = Components.interfaces.nsIPromptService;
  56.         var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
  57.                            .getService(knsIPS);
  58.         var title = gPearlUtil.GetLocalizedString("ALERT_TITLE");
  59.         var msg = gPearlUtil.GetLocalizedString("NOT_LOGGED_IN");
  60.         var btn0Label = gPearlUtil.GetLocalizedString("LOGIN_BUTTON_LABEL");
  61.         var flags = (knsIPS.BUTTON_POS_0 * knsIPS.BUTTON_TITLE_IS_STRING)
  62.                     + knsIPS.BUTTON_POS_0_DEFAULT
  63.                     + (knsIPS.BUTTON_POS_1 * knsIPS.BUTTON_TITLE_CANCEL);
  64.         var notUsed = { value: false };
  65.         var rv = ps.confirmEx(window, title, msg, flags, btn0Label,
  66.                               null, null, null, notUsed);
  67.         if (0 == rv) // Login
  68.           window.opener.openNewWindowWith(gParamObj.loginURL);
  69.       }
  70.  
  71.       function doCancel()
  72.       {
  73.         returnResult(kActionNone);
  74.       }
  75.  
  76.       function returnResult(aAction)
  77.       {
  78.         if (gParamObj)
  79.           gParamObj.action = aAction;
  80.         window.close();
  81.       }
  82.     ]]>
  83.   </script>
  84.  
  85.   <keyset id="dialogKeys"/>
  86.  
  87.   <vbox flex="100%" style="min-width: 1px">
  88.     <description>&actionPromptQuestion.label;</description>
  89.     <grid flex="1">
  90.       <columns><column/><column/></columns>
  91.       <rows>
  92.         <row>
  93.           <button label="&actionPromptEditButton.label;"
  94.                   image="chrome://aviary/skin/edit.png"
  95.                   orient="vertical"
  96.                   oncommand="returnResult(kActionSaveAndOpen);"/>
  97.           <button label="&actionPromptSaveDesktopButton.label;"
  98.                   image="chrome://aviary/skin/save.png"
  99.                   orient="vertical"
  100.                   oncommand="returnResult(kActionSaveToDesktop);"/>
  101.         </row>
  102.         <row>
  103.           <button label="&actionPromptClipboardButton.label;"
  104.                   image="chrome://aviary/skin/clipboard2.png"
  105.                   orient="vertical"
  106.                   oncommand="returnResult(kActionCopyToClipboard);"/>
  107.           <button id="saveToAviary"
  108.                   label="&actionPromptSaveToAviaryButton.label;"
  109.                   image="chrome://aviary/skin/online.png"
  110.                   orient="vertical"
  111.                   oncommand="onSaveToAviary();"/>
  112.         </row>
  113.       </rows>
  114.     </grid>
  115.     <hbox>
  116.       <spacer flex="1"/>
  117.       <button id="cancel" label="&cancelButton.label;"
  118.               oncommand="doCancel();"/>
  119.       <spacer flex="1"/>
  120.     </hbox>
  121.   </vbox>
  122. </window>
  123.